package com.xb.loan.util.xmladapter.convert;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.text.DecimalFormat;

public class DoubleAdapter extends XmlAdapter<String, Double> {
    
	private static DecimalFormat df = new DecimalFormat("0.00");
	
	@Override
	public Double unmarshal(String str) throws Exception {
         
        return df.parse(str).doubleValue();
    }
 
	@Override
	public String marshal(Double d) throws Exception {
		
		return df.format(d);
	}
	
	public static void main(String[] args) {
		System.out.println(1000000000.0);
		System.out.println(df.format(1000000000.0));
	}
	
}